#include <stdio.h>
#include <string.h>

int strStr(char *haystack, char *needle) {
    int haystack_len = strlen(haystack);
    int needle_len = strlen(needle);
    
    if (needle_len == 0) {
        return 0;
    }
    
    for (int i = 0; i <= haystack_len - needle_len; i++) {
        int j;
        for (j = 0; j < needle_len; j++) {
            if (haystack[i + j] != needle[j]) {
                break;
            }
        }
        
        if (j == needle_len) {
            return i;
        }
    }
    
    return -1;
}


int main() {
    char haystack[] = "hello world";
    char needle[] = "wo";
    int result = strStr(haystack, needle);
    printf("The first occurrence of needle in haystack is at index: %d\n", result);

    return 0;
}